<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;


class LoginController extends BaseController
{

        public function login(Request $request)
        {
            $credentials = request(['email', 'password']);
            if (!$token = auth('api')->attempt($credentials)) {
                return $this->response->errorBadRequest();
            }

            return $this->respondWithToken($token);
        }

        public function me()
        {
            return response()->json(auth('api')->user());
        }

        public function logout()
        {
            auth('api')->logout();
            return $this->response->PostSuccess();
        }
//
//        public function refresh()
//        {
//            return $this->respondWithToken(auth('api')->refresh());
//        }
}
